C$PROCEDURE       MMAB
      SUBROUTINE MMAB (A,B,N,M,L,C,NN,MM,LL)
C$    PURPOSE
C    SUBROUTINE MMAB AND ITS ENTRY POINTS MMABT AND MMATB
C    PERFORM MATRIX MULTIPLICATION BETWEEN MATRICES A AND B
C    IN THREE DIFFERENT WAYS:
C     1) MMAB COMPUTES C = A*B
C     2) MMABT COMPUTES C1 = A*(B Transpose)
C     3) MMATB COMPUTES C2 = (A Transpose)*B
C$     INPUT_ARGUMENTS
C     CALLING SEQUENCE ARGUMENTS FOR MMAB --
C
C    NAME       DESCRIPTION
C
C    A          DP MATRIX PREMULTIPLIED ON DP MATRIX B
C
C    B          DP MATRIX POSTMULTIPLIED ON DP MATRIX A
C
C    L          NUMBER OF COLUMNS IN OUTPUT MATRIX C AND FROM B
C
C    LL         ROW DIMENSION OF PRODUCT MATRIX C
C
C    M          NUMBER OF COLUMNS OF A AND ROWS OF B IN 
C               MATRIX PRODUCT
C
C    MM         ROW DIMENSION OF MATRIX B
C
C    N          NUMBER OF ROWS OF A IN MATRIX PRODUCT AND
C               IN OUTPUT MATRIX C
C
C    NN         ROW DIMENSION OF MATRIX A
C
C     CALLING SEQUENCE ARGUMENTS FOR MMABT --
C
C    A          DP MATRIX POSTMULTIPLIED BY B TRANSPOSE
C
C    B          DP MATRIX WHOSE TRANSPOSE IS PREMULTIPLIED BY A
C
C    L          NUMBER OF ROWS IN OUTPUT MATRIX AND FROM A 
C
C    LL         SAME AS FOR MMAB
C
C    M          NUMBER OF COLUMNS OF MATRICES A AND B IN PRODUCT
C
C    MM         SAME AS FOR MMAB
C
C    N          NUMBER OF COLUMNS IN OUTPUT MATRIX AND ROWS FROM B
C
C    NN         SAME AS FOR MMAB
C
C     CALLING SEQUENCE ARGUMENTS FOR MMATB --
C
C    A          DP MATRIX WHOSE TRANSPOSE IS POSTMULTIPLIED BY B
C
C    B          DP MATRIX WHICH IS PREMULTIPLIED BY A TRANSPOSE
C
C    L          NUMBER OF COLUMNS IN OUTPUT MATRIX AND FROM B
C
C    LL         SAME AS FOR MMAB
C
C    M          NUMBER OF ROWS FROM BOTH MATRICES A AND B IN PRODUCT
C
C    MM         SAME AS FOR MMAB
C
C    N          NUMBER OF ROWS IN OUTPUT MATRIX AND COLUMNS FROM A
C
C    NN         SAME AS FOR MMAB
C$    OUTPUT_ARGUMENTS
C     CALLING SEQUENCE ARGUMENTS --
C
C    NAME       DESCRIPTION
C
C    C          OUTPUT MATRIX FROM MMAB
C
C    C1         OUTPUT MATRIX FROM ENTRY POINT MMABT
C
C    C2         OUTPUT MATRIX FROM ENTRY POINT MMATB
C-&
      DOUBLE PRECISION A(NN,1),B(MM,1),C(LL,1)
      DOUBLE PRECISION C1(LL,1),C2(LL,1)
C$     METHOD
C-&
C1    SEE PURPOSE AND ARGUMENT DESCRIPTIONS. MATRIX MULTIPLICATIONS ARE
C1    PERFORMED THROUGH THE STANDARD NESTED DO LOOP APPROACH.
C
C     A(N,M)  B(M,L)  C(N,L)
C
C     MULTIPLY TWO MATRICES, A*B, PLACE PRODUCT IN C
C     A - FIRST INPUT MATRIX
C     B - SECOND INPUT MATRIX
C     C - PRODUCT MATRIX A*B
C
C     NN- ROW DIMENSION OF A MATRIX
C     MM- ROW DIMENSION OF B MATRIX
C     LL- ROW DIMENSION OF C MATRIX
C
C     N - NUMBER OF ROWS OF A, ROWS OF C
C     M - NUMBER OF COLS OF A, ROWS OF B
C     L - NUMBER OF COLS OF B, COLS OF C
C
      DO 100 I=1,N
      DO 100 J=1,L
      C(I,J)=0.D0
      DO 100 K=1,M
  100 C(I,J)=C(I,J)+A(I,K)*B(K,J)
      RETURN
      ENTRY MMABT(A,B,L,M,N,C1,NN,MM,LL)
C
C             B(N,M)
C     A(L,M) BT(M,N)  C(L,N)
C
C     FORM PRODUCT A POSTMULTIPLIED BY TRANSPOSE OF B
C     A - FIRST INPUT MATRIX
C     B - SECOND INPUT MATRIX
C     C - PRODUCT MATIRX A*BT
C
C     L - NUMBER OF ROWS OF C
C     M - NUMBER OF COLS OF A, COLS OF B
C     N - NUMBER OF ROWS OF B, COLS OF C
C
      DO 200 I=1,L
      DO 200 J=1,N
      C1(I,J)=0.D0
      DO 200 K=1,M
  200 C1(I,J)=C1(I,J)+A(I,K)*B(J,K)
      RETURN
      ENTRY MMATB(A,B,M,N,L,C2,NN,MM,LL)
C
C      A(M,N)
C     AT(N,M)  B(M,L)  C(N,L)
C
C     FORM PRODUCT A-TRANSPOSE POSTMULTIPLIED BY B, PRODUCT IN C
C
C     A - FIRST  INPUT MATRIX
C     B - SECOND INPUT MATRIX
C     C - PRODUCT MATRIX AT*B
C
C
C     M - NUMBER OF ROWS OF A, ROWS OF B
C     N - NUMBER OF COLS OF A, ROWS OF C
C     L - NUMBER OF COLS OF B,COLS OF C
C
      DO 300 I=1,N
      DO 300 J=1,L
      C2(I,J)=0.D0
      DO 300 K=1,M
  300 C2(I,J)=C2(I,J)+A(K,I)*B(K,J)
      RETURN
      END
